/**
 * @file bull_hal_drv_pin.h
 * @brief 
 * @author yejing (yejh@gongniu.cn)
 * @version 1.0
 * @date 2024-05-28
 * 
 * Copyright 2024-2025 GongNiu Inc. All Rights Reserved.
 * 
 */

#ifndef _BULL_HAL_DRV_PIN_H
#define _BULL_HAL_DRV_PIN_H

#ifdef __cplusplus
extern "C" {
#endif

#include "bull_hal_adapter.h"

/**
 * @brief 初始化 pin 脚
 * 
 * @param pin pin 引脚
 * @param mode 输入输出模式
 * @param irq_mode 中断触发模式
 * @param irq_cb 中断回调函数
 * @return int 
 */
int bull_hal_drv_pin_init( BULL_PIN_NAME_t pin, BULL_PIN_MODE_T mode, BULL_PIN_ACTIVE_T pin_active, BULL_IRQ_MODE_T irq_mode, BULL_PIN_IRQ_CB irq_cb);

/**
 * @brief 复位pin的初始化
 * 
 * @param pin 
 * @return int 
 */
int bull_hal_drv_pin_deinit( BULL_PIN_NAME_t pin );

/**
 * @brief GPIO 写
 * 
 * @param pin 
 * @param level 
 * @return int 
 */
int bull_hal_drv_pin_write( BULL_PIN_NAME_t pin, BULL_PIN_LEVEL_t level );

/**
 * @brief GPIO 读
 * 
 * @param pin 
 * @return int 
 */
int bull_hal_drv_pin_read( BULL_PIN_NAME_t pin );

/**
 * @brief GPIO 翻转
 * 
 * @param pin 
 * @return int 
 */
int bull_hal_drv_pin_toggle( BULL_PIN_NAME_t pin );


#ifdef __cplusplus
}
#endif


#endif
